<script setup>
import { ref , reactive} from 'vue'
import regPhoneForm from './regPhoneForm.vue'
    let  activeStep = ref(0)
    let  activeName = ref('phone')
    let  initForm = reactive({})

    const onPreStep = () => {
      activeStep.value--
    }
    const onNextStep = () => {
      activeStep.value++
    }
    const onSubmit = (val) => {
      initForm = { ...val }
      onNextStep()
    }
</script>

<template>
  <div class="login-tab">
    <el-steps :active="activeStep" align-center>
      <el-step :title="$t('设置用户名')" />
      <el-step :title="$t('填写个人信息')" />
      <el-step :title="$t('注册成功')" />
    </el-steps>
    <div v-show="activeStep === 0" class="reg-form">
      <div class="reg-radio">
        <el-radio-group v-model="activeName">
          <el-radio-button label="phone">{{ $t('手机') }}</el-radio-button>
          <el-radio-button label="email">{{ $t('邮箱') }}</el-radio-button>
        </el-radio-group>
        <reg-phone-form v-show="activeName === 'phone'" @submit="onSubmit" />
        <reg-email-form v-show="activeName === 'email'" @submit="onSubmit" />
      </div>
    </div>
    <div v-show="activeStep === 1" class="reg-form">
      <reg-inform :init-form="initForm" @onPreStep="onPreStep" />
    </div>
  </div>
</template>

<style lang="scss" scoped>
    :deep(){
      .el-step__title {
        font-size: 14px;
        &.is-process,&.is-finish {
          color: #EE9B0A;
        }
      }
       .el-step__head.is-process, .el-step__head.is-finish {
        color: #EE9B0A;
        border-color: #EE9B0A;
      }
    }
  .reg-form {
    width: 327px;
    margin: 30px auto 0;
  }
  .reg-radio {
    text-align: center;
  }
  .login-tab {
    margin-top: 20px;
    .el-tabs__header {
      padding: 0
    }
  }
</style>